<?php

/** libraries
 * http://docs.joomla.org/JToolBarHelper
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

class bgViewbg extends JView
{
	// Overwriting JView display method
	function display($tpl = null) 
	{
        $model = $this->getModel();
        $task = &JRequest::getVar('task');
        switch($task){
            case 'detail':
                $this->setLayout('detail');
                $cid = JRequest::getVar('cid');
                $this->rows = $model->load($cid);
                $this->mobj=$model->getAllMobj();
                $this->mcon=$model->getAllMcon();
                $this->mfac=$model->getAllMfac();
                $this->pref=$model->getAllPref();
                $this->pede=$model->getAllPede();
                $this->list = &JRequest::getVar('jform');
            break;
            
            default :
                //check submit search
                $check = &JRequest::getVar('check');
                if($check == '1')
                {
                    $this->sr = '1';
                }
                else $this->sr = '0';
                $this->setLayout('default');                
                $this->pref=$model->getAllPref();
                $this->pede=$model->getAllPede();
                $this->mobj=$model->getAllMobj();
                $this->mcon=$model->getAllMcon();
                $this->mfac=$model->getAllMfac();
                $this->list = &JRequest::getVar('jform');
                $this->rows=$model->getAll($this->list);
                 $this->pagination = $this->get('Pagination'); 

        }
        
		parent::display();
	}
}




